

window = global;

delete global
delete Buffer

navigator = {
    appCodeName: "Mozilla",
    appName: "Netscape",
    appVersion: "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
    userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
}


canvas = {
    getContext:function(){}
}

document = {
    createElement: function(ele){
        console.log(ele)
        if(ele=='canvas'){
            return canvas
        }else if(ele=='div'){
            return {}
        }
    },
    documentElement :{},
    cookie:'abRequestId=e680cf11-30ff-5c61-80b2-477c37314791; xsecappid=xhs-pc-web; a1=1923c8e8ec93qax9g045ss76sq5l1vu3bbhiufh8c50000214839; webId=30b4cbde16de5fa9607d1ef6d2db2244; gid=yjJqSYdj8JDdyjJqSYdYdDixSjqA0Cjk842MxYSMWKMA23281yh7q7888Jy4Yqj8SSDJKj28; webBuild=4.47.1; unread={%22ub%22:%22674004a80000000007030c85%22%2C%22ue%22:%2267425bd90000000006016123%22%2C%22uc%22:25}; websectiga=6169c1e84f393779a5f7de7303038f3b47a78e47be716e7bec57ccce17d45f99; sec_poison_id=d94f1608-0a7d-4873-bd65-66e1b97385f3'
}

localStorage = {
    getItem:function(key){}
}

function getEnv(proxy_array) {
    for(let i=0; i<proxy_array.length; i++){
        handler = `{
            get: function(target, property, receiver) {
                   if(property != 'Math'){
                        console.log('方法：get','    对象：${proxy_array[i]}','    属性：',property,'    属性类型：',typeof property,'    属性值类型：',typeof target[property]);
                   }

                   return target[property];
            },
            set: function(target, property, value, receiver){
                    console.log('方法：set','    对象：${proxy_array[i]}','    属性：',property,'    属性类型：',typeof property,'    属性值类型：',typeof target[property]);
                    return Reflect.set(...arguments);
            }
        }`;
        eval(`
            try{
                ${proxy_array[i]};
                ${proxy_array[i]} = new Proxy(${proxy_array[i]},${handler});
            }catch(e){
                ${proxy_array[i]}={};
                ${proxy_array[i]} = new Proxy(${proxy_array[i]},${handler});
            }
        `);
    }
}


getEnv(['window','navigator','document','location','localStorage'])